<template>
  <div class="app-container chart-bg">
    <el-row :gutter="20">
      <el-col :span="6" :xs="12">
        <div class="grid-content">
          <svg-icon icon-class="user" class-name="card-panel-icon" />
          <div class="grid-content-right">
            <h3>用户数</h3>
            <div class="number">{{ allTotal.userTotal }}</div>
          </div>
        </div>
      </el-col>
      <el-col :span="6" :xs="12"
        ><div class="grid-content">
          <svg-icon icon-class="lbt" class-name="card-panel-icon" />
          <div class="grid-content-right">
            <h3>轮播图数</h3>
            <div class="number">{{ allTotal.bannnerTotal }}</div>
          </div>
        </div>
      </el-col>
      <el-col :span="6" :xs="12"
        ><div class="grid-content">
          <svg-icon icon-class="xw" class-name="card-panel-icon" />
          <div class="grid-content-right">
            <h3>新闻数</h3>
            <div class="number">{{ allTotal.newsTotal }}</div>
          </div>
        </div></el-col
      >
      <el-col :span="6" :xs="12"
        ><div class="grid-content">
          <svg-icon icon-class="application" class-name="card-panel-icon" />
          <div class="grid-content-right">
            <h3>客户申请数</h3>
            <div class="number">1000</div>
          </div>
        </div></el-col
      >
    </el-row>
  </div>
</template>

<script setup>
import { comprehensiveData } from '@/api/search'
import { ref } from 'vue'
defineOptions({ name: 'PanelGroup' })
const allTotal = ref({
  userTotal: 0,
  newsTotal: 0,
  bannnerTotal: 0
})
// 数据请求
async function getComprehensive() {
  try {
    const response = await comprehensiveData()
    allTotal.value = response.data
  } catch (error) {
    console.log('error: ', error)
  }
}
getComprehensive()
</script>

<style lang="scss" scoped>
.chart-bg {
  margin-bottom: 20px;
}
.grid-content {
  height: 110px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background-color: #fff;
}
.card-panel-icon {
  font-size: 48px;
  color: #40c9c6;
}
.grid-content-right h3 {
  line-height: 18px;
  color: rgba(0, 0, 0, 0.45);
  font-size: 16px;
  margin-bottom: 12px;
}
.grid-content-right .number {
  font-size: 20px;
  font-weight: bold;
}
</style>
